🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / app / src / main / kotlin / org / meshtastic / app / map / component / MapControlsOverlay.kt
Displaying Raw • Download
app/src/main/kotlin/org/meshtastic/app/map/component/MapControlsOverlay.kt 520fa717a938fd84682403b41f57d9f7e1ef49ef (520fa717) Text, 5.33 KB
T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.app.map.component
Tff7b72import T7ee787androidx.compose.foundation.layout.Box
Tff7b72import T7ee787androidx.compose.foundation.layout.Row
Tff7b72import T7ee787androidx.compose.foundation.layout.padding
Tff7b72import T7ee787androidx.compose.foundation.layout.size
Tff7b72import T7ee787androidx.compose.material3.CircularProgressIndicator
Tff7b72import T7ee787androidx.compose.material3.MaterialTheme
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.draw.rotate
Tff7b72import T7ee787androidx.compose.ui.unit.dp
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.map_filter
Tff7b72import T7ee787org.meshtastic.core.resources.orient_north
Tff7b72import T7ee787org.meshtastic.core.resources.refresh
Tff7b72import T7ee787org.meshtastic.core.resources.toggle_my_position
Tff7b72import T7ee787org.meshtastic.core.ui.icon.LocationDisabled
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MapCompass
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MeshtasticIcons
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MyLocation
Tff7b72import T7ee787org.meshtastic.core.ui.icon.Refresh
Tff7b72import T7ee787org.meshtastic.core.ui.icon.Tune
Tff7b72import T7ee787org.meshtastic.core.ui.theme.StatusColors.StatusRed
T8b949e/**
* Shared map controls overlay used by both Google and F-Droid map views. Provides compass, filter button, location
* tracking button, and optional slots for flavor-specific content (map type selector, layers, refresh).
*
* @param onToggleFilterMenu Callback to open/close the filter dropdown.
* @param filterDropdownContent Composable rendered inside a [Box] alongside the filter button — typically a
* `DropdownMenu` with filter options.
* @param mapTypeContent Optional composable for a map type selector button + dropdown. Google flavor provides map type
* and custom tile options; F-Droid provides a tile source selector.
* @param layersContent Optional composable for a layers management button.
* @param showRefresh Whether to show a refresh button (e.g., for network map layers).
* @param isRefreshing Whether a refresh is currently in progress.
* @param onRefresh Callback when the refresh button is clicked.
*/
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffLongParameterListTa5d6ff"Tb4b4b4)
Tf0883e@Composable
Tff7b72fun Td2a8ffMapControlsOverlayTb4b4b4(
Te6edf3onToggleFilterMenuTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3modifierTb4b4b4: Te6edf3Modifier Tff7b72= Te6edf3ModifierTb4b4b4,
Te6edf3bearingTb4b4b4: Tffa657Float Tff7b72= T79c0ff0fTb4b4b4,
Te6edf3onCompassClickTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3followPhoneBearingTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3filterDropdownContentTb4b4b4: Tf0883e@Composable Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3mapTypeContentTb4b4b4: Tf0883e@Composable Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3layersContentTb4b4b4: Tf0883e@Composable Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3isLocationTrackingEnabledTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3onToggleLocationTrackingTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3showRefreshTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3isRefreshingTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3onRefreshTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3RowTb4b4b4(Te6edf3modifier Tff7b72= Te6edf3modifierTb4b4b4) Tb4b4b4{
T8b949e// Compass
Te6edf3CompassButtonTb4b4b4(Te6edf3onClick Tff7b72= Te6edf3onCompassClickTb4b4b4, Te6edf3bearing Tff7b72= Te6edf3bearingTb4b4b4, Te6edf3isFollowing Tff7b72= Te6edf3followPhoneBearingTb4b4b4)
T8b949e// Filter button + dropdown
Te6edf3Box Tb4b4b4{
Te6edf3MapButtonTb4b4b4(
Te6edf3icon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3TuneTb4b4b4,
Te6edf3contentDescription Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3map_filterTb4b4b4)Tb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onToggleFilterMenuTb4b4b4,
Tb4b4b4)
Te6edf3filterDropdownContentTb4b4b4(Tb4b4b4)
Tb4b4b4}
T8b949e// Map type selector (flavor-specific)
Te6edf3mapTypeContentTb4b4b4(Tb4b4b4)
T8b949e// Layers button (flavor-specific)
Te6edf3layersContentTb4b4b4(Tb4b4b4)
T8b949e// Refresh button (optional)
Tff7b72if Tb4b4b4(Te6edf3showRefreshTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3isRefreshingTb4b4b4) Tb4b4b4{
Te6edf3BoxTb4b4b4(Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3paddingTb4b4b4(T79c0ff8.Te6edf3dpTb4b4b4)Tb4b4b4) Tb4b4b4{
Te6edf3CircularProgressIndicatorTb4b4b4(Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3sizeTb4b4b4(T79c0ff2T79c0ff4.Te6edf3dpTb4b4b4)Tb4b4b4, Te6edf3strokeWidth Tff7b72= T79c0ff2.Te6edf3dpTb4b4b4)
Tb4b4b4}
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3MapButtonTb4b4b4(
Te6edf3icon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3RefreshTb4b4b4,
Te6edf3contentDescription Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3refreshTb4b4b4)Tb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onRefreshTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
T8b949e// Location tracking button
Te6edf3MapButtonTb4b4b4(
Te6edf3icon Tff7b72= Tff7b72if Tb4b4b4(Te6edf3isLocationTrackingEnabledTb4b4b4) Te6edf3MeshtasticIconsTb4b4b4.Te6edf3LocationDisabled Tff7b72else Te6edf3MeshtasticIconsTb4b4b4.Te6edf3MyLocationTb4b4b4,
Te6edf3contentDescription Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3toggle_my_positionTb4b4b4)Tb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onToggleLocationTrackingTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tf0883e@Composable
Tff7b72private Tff7b72fun Td2a8ffCompassButtonTb4b4b4(Te6edf3onClickTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4, Te6edf3bearingTb4b4b4: Tffa657FloatTb4b4b4, Te6edf3isFollowingTb4b4b4: Tffa657BooleanTb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3iconTint Tff7b72=
Tff7b72when Tb4b4b4{
Te6edf3isFollowing Tff7b72-Tff7b72> Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3primary
Te6edf3bearing Tff7b72=Tff7b72= T79c0ff0f Tff7b72-Tff7b72> Te6edf3MaterialThemeTb4b4b4.Te6edf3colorSchemeTb4b4b4.Te6edf3StatusRed
Tff7b72else Tff7b72-Tff7b72> Tff7b72null
Tb4b4b4}
Te6edf3MapButtonTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3rotateTb4b4b4(Tff7b72-Te6edf3bearingTb4b4b4)Tb4b4b4,
Te6edf3icon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3MapCompassTb4b4b4,
Te6edf3iconTint Tff7b72= Te6edf3iconTintTb4b4b4,
Te6edf3contentDescription Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3orient_northTb4b4b4)Tb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onClickTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.06s